Show every model in the /model picker via gateway discovery - #9
Merged
Conversation
Background research (docs/research/2026-08-20-model-picker.md) found Claude
Code's supported mechanism: CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
fetches {base}/v1/models at startup and adds rows labeled "From gateway" —
keeping only ids containing claude|anthropic. So:
- Each GPT model gets a second alias, anthropic-compat/<id>, which passes the
filter with a readable name; the alias IS the inference mapping, so picking
the row just works.
- The launcher exports the discovery flag on the proxy route.
- claude-code.disable-cloaking-model-list: true in the proxy config —
without it CLIProxyAPI serves the picker REVERSED pseudo-claude ids
(claude-fable-5-dd-los-6.5-tpg), which is its own filter workaround and
reads as gibberish.
- That option needs a recent CLIProxyAPI, so the installer feature-detects it
on the binary (strings | grep) and upgrades/downloads when absent.
The feature gate initially failed on success: grep -q exits at first match,
strings dies of SIGPIPE, pipefail turns that into failure — the same class as
the json extractors. Guarded the same way, with a regression test.
Verified live on a fresh reinstall: 12 picker rows cached (4 claude +
8 anthropic-compat/gpt), inference on plain and prefixed ids, claude direct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the last gap:
/modelinside a session now lists all 12 models.How (from primary-source research, checked into
docs/research/)Claude Code has a documented gateway-discovery mechanism:
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1makes it fetch{ANTHROPIC_BASE_URL}/v1/modelsat startup and add picker rows labeled"From gateway" — but a hard filter keeps only ids containing
claude/anthropic. Three pieces make GPT models pass it cleanly:anthropic-compat/<id>. The alias is the inference mapping, so picking therow routes to the real model — no strip logic anywhere.
claude-code.disable-cloaking-model-list: true: without it CLIProxyAPIapplies its own filter workaround and serves reversed pseudo-claude ids
(
claude-fable-5-dd-los-6.5-tpg— that'sgpt-5.6-solbackwards). Realdiscovery, gibberish picker.
it on the candidate binary (
strings | grep) and upgrades viabrew/release download when absent — never version-string parsing.
The bug the gate grew
strings | grep -qunderset -euo pipefailfails on SUCCESS: grep exits atthe first match, strings dies of SIGPIPE. Same class as the json extractors
in #4; same subshell guard, plus a regression test in
tests/extractors.sh.Verified live (fresh delete + reinstall)
~/.claude/cache/gateway-models.json)anthropic-compat/gpt-*--model gpt-5.6-sol(plain alias)--model anthropic-compat/gpt-5.4(picker row id)Research report with binary offsets and doc citations:
docs/research/2026-08-20-model-picker.md.